package com.langshixiaobai.springbootdemo.controller;

import com.langshixiaobai.springbootdemo.entity.MessageWallEneity;
import com.langshixiaobai.springbootdemo.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

//留言墙项目
@RestController
public class MessageWallController {

    private List<MessageWallEneity> list = new ArrayList<>();

    @RequestMapping("/getMessage")
    public List<MessageWallEneity> message() {
        System.out.println("返回消息");
        return list;
    }

    @RequestMapping("/addMessage")
    public MessageWallEneity addMessage(MessageWallEneity message) {
        System.out.println("接收到消息："+ message);
        list.add(message);
        //返回数据
        return message;
    }

}
